﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using Meraz.Core.Model;
using Meraz.Core.Repositories;

namespace Meraz.Core.Commands
{
    public interface IGetLinkCommand
    {
        ILinkRepository LinkRepository { get; set; }
        Link Execute(int postID, string linkUrl);
    }
    public class GetLinkCommand: BaseCommand, IGetLinkCommand
    {
        [Inject]
        public ILinkRepository LinkRepository { get; set; }

        public Link Execute(int postID, string linkUrl)
        {
            return LinkRepository.GetByHref(postID, linkUrl);
        }
        public Link Execute(int linkID)
        {
            return LinkRepository.GetById(linkID);
        }
    }
}
